package cn.maihe.elg.operation.repository.entity;

import cn.maihe.framework.starter.base.sql.BaseEntity;
import cn.maihe.framework.starter.base.sql.MapperInterface;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@TableName("t_kt_customer_change_apply")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@MapperInterface("cn.maihe.elg.operation.repository.mapper.KtCustomerChangeApplyMapper")
public class KtCustomerChangeApplyDO extends BaseEntity {
    /**
     * id
     */
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 投标客户id
     */
    @TableField(value = "bidder_id")
    private Long bidderId;

    /**
     * 投标企业名称
     */
    @TableField(value = "bidder_name")
    private String bidderName;

    /**
     * 凯特订单id
     */
    @TableField(value = "order_id")
    private String orderId;

    /**
     * 凯特投标客户id
     */
    @TableField(value = "user_id")
    private String userId;

    /**
     * 经办人
     */
    @TableField(value = "handler_name")
    private String handlerName;

    /**
     * 经办人手机号
     */
    @TableField(value = "handler_mobile")
    private String handlerMobile;

    /**
     * 经办人身份证
     */
    @TableField(value = "handler_idcard")
    private String handlerIdcard;

    /**
     * 经办人身份证复印件
     */
    @TableField(value = "handler_id_pic")
    private String handlerIdPic;

    /**
     * 申请表
     */
    @TableField(value = "apply_pic")
    private String applyPic;

    /**
     * 变更函复印件
     */
    @TableField(value = "change_pic")
    private String changePic;

    /**
     * 变更前名称
     */
    @TableField(value = "pre_bidder_name")
    private String preBidderName;

    /**
     * 凯特状态
     */
    @TableField(value = "state")
    private Integer state;

    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;

    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    @TableField(value = "user_create", fill = FieldFill.INSERT)
    private String userCreate;

    @TableField(value = "user_modified", fill = FieldFill.INSERT_UPDATE)
    private String userModified;

    /**
     * 结果查询次数
     */
    @TableField(value = "result_query_times")
    private Integer resultQueryTimes;

    /**
     * 平台状态
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 最新标志 0否 1最新
     */
    @TableField(value = "last_flag")
    private Integer lastFlag;

    /**
     * 审批状态
     */
    @TableField(value = "audit_desc")
    private String auditDesc;

    public KtCustomerChangeApplyVo buildVo() {
        return new KtCustomerChangeApplyVo(id, bidderId, bidderName, orderId, userId, handlerName, handlerMobile, handlerIdcard, handlerIdPic, applyPic, changePic, preBidderName, state, gmtCreate, gmtModified, userCreate, userModified, resultQueryTimes, status, lastFlag, auditDesc);
    }

    public static KtCustomerChangeApplyDO of(KtCustomerChangeApplyVo vo) {
        return new KtCustomerChangeApplyDO(vo.getId(), vo.getBidderId(), vo.getBidderName(), vo.getOrderId(), vo.getUserId(), vo.getHandlerName(), vo.getHandlerMobile(), vo.getHandlerIdcard(), vo.getHandlerIdPic(), vo.getApplyPic(), vo.getChangePic(), vo.getPreBidderName(), vo.getState(), vo.getGmtCreate(), vo.getGmtModified(), vo.getUserCreate(), vo.getUserModified(), vo.getResultQueryTimes(), vo.getStatus(), vo.getLastFlag(), vo.getAuditDesc());
    }
}